<template>
	<view>
		<view class="map">
			<map name=""></map>
		</view>
		<view class="near">
			<u-icon name="map" color="#2979ff" size="50"></u-icon>
			<text>当前最近站点：建国门站</text>
		</view>
		<view class="metro-list">
			<navigator class="metro-item" v-for="item in metroList" :url="`/pages/metro-detail/metro-detail?id=${item.lineId}`">
				<view class="path">{{item.lineName}}</view>
				<view class="bottom">
					<view class="left center">
						<text>下一站：</text>
						<text>{{item.nextStep.name}}</text>
					</view>
					<view class="right center">
						<text>到本站时长：</text>
						<text>{{item.reachTime}} 分钟</text>
					</view>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				metroList: []
			};
		},
		onLoad() {
			this.getMetro()
		},
		onNavigationBarButtonTap() {
			uni.navigateTo({
				url:'/pages/metro-picture/metro-picture'
			})
		},
		methods:{
			getMetro(){
				this.$request({
					url: '/prod-api/api/metro/list',
					data:{
						currentName:'建国门'
					}
				}).then(res => {
					console.log(res)
					this.metroList = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	height: 100%;
	background-color: #f7f7f7;
	view{
		padding: 20rpx;
		.map{
			width: 100%;
			height: 400rpx;
			padding: 20rpx;
			background-color: #fff;
			border-radius: 20rpx;
		}
		.near{
			background-color: #fff;
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			margin-top: 40rpx;
			border-radius: 20rpx;
		}
		.metro-list{
			display: flex;
			flex-direction: column;
			.metro-item{
				padding: 20rpx;
				background-color: #fff;
				display: flex;
				flex-direction: column;
				margin-top: 30rpx;
				position: relative;
				&::after{
					content: '';
					position: absolute;
					border-bottom: 4rpx dashed #19b16b;
					width: 100%;
					bottom: -14rpx;
					left: 0;
				}
				.path{
					color: #2979ff;
					font-weight: bold;
					font-size: 36rpx;
					border-bottom: 4rpx solid #e4e7ed;
				}
				.bottom{
					display: flex;
					flex-direction: row;
					justify-content: space-around;
					.left{
						display: flex;
						flex-direction: column;
						:nth-child(2){
							color: #ff9900;
							font-size: 36rpx;
							font-weight: bold;
							margin-top: 10rpx;
						}
					}
					.right{
						display: flex;
						flex-direction: column;
						:nth-child(2){
							color: #fa3534;
							font-size: 36rpx;
							font-weight: bold;
							margin-top: 10rpx;
						}
					}
				}
			}
		}
	}
}
</style>
